package com.yx.study.leet.primary.dp;

/**
 * @Classname ClimbStairs
 * @Date 2023/01/15 21:22
 * @Author by yx
 * @Description : 爬楼梯(尾递归)
 * https://leetcode.cn/leetbook/read/top-interview-questions-easy/xn854d/
 */
public class ClimbStairs {
    public static int climbStairs(int n) {
        return Fibonacci(n, 1, 1);
    }

    public static int Fibonacci(int n, int a, int b) {
        if (n <= 1) {
            return b;
        }
        return Fibonacci(n - 1, b, a + b);
    }
}
